<template>
	<div class="section page_2">
		<img src="/ilink-app-h5-zd/static/img/ilink_1577974459761.png" class="startContentBg">
		<div class="page_2_content">
			<div class="page_2_flex" style="justify-content: flex-start;">
				<count-to class="aaa" :startVal="0" :endVal="continueTime" :duration="3000"></count-to>
				{{timeUnit}}<span id="company_1"></span>
			</div>
			<p>这是您加入智慧消防大家庭的时间</p>
			<div class="page_2_flex">
				<count-to class="aaa" :startVal="0" :endVal="dataCount" :duration="3000"></count-to>
				<span>数据</span></div>
			<p id="page_2_nums_des">我们一年为您累积了{{dataCount}}条</p>
			<animation-text :text="animationText"></animation-text>
		</div>
	</div>
</template>

<script>
export default {
	components: {
		
	},
	props: {
		reportData: {
			type: Object,
			default: function () {
				return {
					joinTime: {},
				}
			},
		},
		active: {
			type: Boolean,
			default: false,
		},
	},
	data() {
		return {
			dataCount: 0,
			continueTime: 0,
			timeUnit:'',
			animationText: '',
		}
	},
	watch: {
		active(val) {
			if (val) {
				this.$nextTick(() => {
					this.init()
				})
			}
		},
	},
	methods: {
		init() {
			this.animationText = `这是我们为您一年积累的数据，如果换算成《中华人民共和国消防法》,足足有${this.reportData.joinTime.fireLawCount}本。`
			this.continueTime = Number(this.reportData.joinTime.continueTimeStr.replace(/[^0-9]/ig,""))
			this.timeUnit = this.reportData.joinTime.continueTimeStr.replace(/[0-9]/ig,"")
			this.dataCount = this.reportData.joinTime.dataCount
		}
	},
	mounted() {},
}
</script>